<?php
/**
* smarty function to get constant value which define before
* @param  name    the constant name
* @param  assign  the assign to variable name
* @return string of value or assign to value if assign param is set
*/
function smarty_function_keyword_user($params, &$smarty) 
{
    //Get value from page
    $user_id = $params['user_id'];
    if($user_id){
      //Query data
      $sql = "SELECT
                pn_uda_value  
              FROM
                zk_user_data 
              WHERE
                pn_uda_uid = ".$user_id." and pn_uda_propid = 1";

      $column = array("pn_uda_value");
      $result = DBUtil::executeSQL($sql);
      $objectArray = DBUtil::marshallObjects ($result, $column);
      $user = $objectArray['0']['pn_uda_value'];
     
    }
    if ($user_id) {
        echo ", ของ".$user; 
    } else {
        echo "";
    }
}